# -*- coding: utf-8 -*-
from datetime import datetime
import pandas as pd
import numpy as np

if __name__ == '__main__':
    """
        过滤  扔掉符合条件的数据
    """
    date_list = [datetime(2018,1,1), datetime(2018,1,2), datetime(2018,1,3),
                 datetime(2018,1,4), datetime(2018,1,5), datetime(2018,1,6)]
    # date_list = [3, 4,5,
    #              6,7,8]
    # print date_list
    series = pd.Series(np.random.randn(6),date_list)
    truncate = series.truncate(before="2018-1-3")
    print truncate
    series_truncate = series.truncate(after="2018-01-02")
    print series_truncate
    print "---------传入开始，结束日期，默认生成的该时间段的时间是按天计算的---------------------------------"
    date_range = pd.date_range("2018-01-01", "2018-01-20")
    print date_range
    print "---------只传入开始或结束日期，还需要传入时间段-----------------------------------------------"
    print pd.date_range("2018-1-1",periods=10)
    print "只指定结束日期"
    print pd.date_range(end="2018-1-1",periods=10)
    print "规范化时间戳"
    print pd.date_range(start='2018/01/01 12:13:14', periods=10)
    print pd.date_range(start='2018/01/01 12:13:14', periods=10, normalize=True)
